import Cookies from 'js-cookie'
// import {sysType} from './checkoutSys'
export default ({ app ,redirect}) => {
    app.router.beforeEach((to,from,next)=>{
      if(process.browser && to.meta.title){
        document.title = to.meta.title

      }

      if(Cookies.get("sysType") == 'exam'){
        if(to.path!='/login' & to.path!='/result' & to.path!='/shijuan' & to.path!='/login_exam' & to.path!='/home' & to.path!='/signUp' & to.path!='/exams' & to.path!='/inquireScore' & to.path!='/signuppage'){
          redirect({ path: '/login_exam' })
        }
      }else{
        if(to.path=="/"){
          redirect({ path: '/login_exam' })
        }
      }

			next();
    })
}
